//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    active:1,
    bannerImg:"../img/topbanner.png",//首页图片
    items:[
      {img:'../img/nva1.png',txt:'成人险'},
      { img: '../img/nva2.png', txt: '儿童险' },
      { img: '../img/nva3.png', txt: '老年险' },
      { img: '../img/nva4.png', txt: '全部险' },
    ],
    poroducts:[
      {img:"../img/poroduct1.png",},
      { img: "../img/poroduct1.png", },
    ],
    middles:[
      { img: "../img/programme.png", txt: "方案定制", page:"../customized/customized"},
      { img: "../img/telephone.png", txt: "客服电话" },
      { img: "../img/chat.png", txt: "在线客服" },
      { img: "../img/demand.png", txt: "需求评测", page: "../demand/demand" },      
    ],
    commodity:[
      { img:"../img/commodity1.jpg",title:"哆啦噩梦保证疾病大保险",nums:"100种重疾+55种情急",tips:"中正请追赠多次佩服",price:"880.00"},
      { img: "../img/commodity1.jpg", title: "哆啦噩梦保证疾病大保险", nums: "100种重疾+55种情急", tips: "中正请追赠多次佩服", price: "880" },
      { img: "../img/commodity1.jpg", title: "哆啦噩梦保证疾病大保险", nums: "100种重疾+55种情急", tips: "中正请追赠多次佩服", price: "880" },
      { img: "../img/commodity1.jpg", title: "哆啦噩梦保证疾病大保险", nums: "100种重疾+55种情急", tips: "中正请追赠多次佩服", price: "880" },
    ],
    people:[
      {name:"给自己",id:"1"},
      { name: "给家人", id: "2" },
      { name: "给小孩", id: "3" },
    ]
  },
  //事件处理函数
  bindViewTap: function() {
    wx.navigateTo({
      url: '../logs/logs'
    })
  },
  onLoad: function () {
    if (app.globalData.userInfo) {
      this.setData({
        userInfo: app.globalData.userInfo,
        hasUserInfo: true
      })
    } else if (this.data.canIUse){
      // 由于 getUserInfo 是网络请求，可能会在 Page.onLoad 之后才返回
      // 所以此处加入 callback 以防止这种情况
      app.userInfoReadyCallback = res => {
        this.setData({
          userInfo: res.userInfo,
          hasUserInfo: true
        })
      }
    } else {
      // 在没有 open-type=getUserInfo 版本的兼容处理
      wx.getUserInfo({
        success: res => {
          app.globalData.userInfo = res.userInfo
          this.setData({
            userInfo: res.userInfo,
            hasUserInfo: true
          })
        }
      })
    }
  },
  headler(options){
    this.setData({
      active:options.currentTarget.dataset.id
    })
  },
  Methods(e){
    console.log(e)
      let tiao=e.currentTarget.dataset.page
      wx.navigateTo({
        url: tiao,
      })
  }
})
